package com.zego.wawaji.ui.center.invite;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.zego.wawaji.R;
import com.zego.wawaji.base.module.ModuleMgr;
import com.zego.wawaji.third.image.ImageLoader;
import com.zego.wawaji.third.share.ShareUtils;
import com.zego.wawaji.third.share.util.ShareEnum;
import com.zego.wawaji.ui.base.BaseAppCompatActivity;
import com.zego.wawaji.ui.dialog.PickerDialogUtil;
import com.zego.wawaji.ui.dialog.share.ShareDialog;

/**
 * 邀请界面
 * Created by Su on 2017/11/27.
 */
public class InviteAct extends BaseAppCompatActivity implements ShareDialog.OnShareClickListener {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_invite_act);
        initView();
    }

    private void initView() {
        setTitle("邀请好友");
        setBackView();
        ShareUtils.getInstance().reqShareData(null);
        findViewById(R.id.invite_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PickerDialogUtil.showShareDialog(InviteAct.this);
            }
        });

        ImageView inviteBg = (ImageView) findViewById(R.id.invite_bg);
        String inviteUrl = ModuleMgr.getWawaMgr().getCommon().getInviteImg();
        if (!TextUtils.isEmpty(inviteUrl))
            ImageLoader.loadCenterCrop(this, inviteUrl, inviteBg, R.drawable.my_invite_bg, R.drawable.my_invite_bg);
    }

    @Override
    public void shareWeiXin() {
        ShareUtils.getInstance().shareData(this, ShareEnum.WEIXIN);
    }

    @Override
    public void shareWXCircle() {
        ShareUtils.getInstance().shareData(this, ShareEnum.WEIXIN_FRIENDS);
    }

    @Override
    public void shareLink() {
        ShareUtils.getInstance().shareData(this, ShareEnum.COPY);
    }
}
